home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
d86bios4.zip
/
ZBIOS1.8
< prev
next >
Wrap
Text File
|
1989-07-07
|
35KB
|
960 lines
;------------------
; WANG INTERFACE
;------------------
; Thanks to Alan Tschetter for providing the information necessary for me
; to program this interface.
WANG_KEYS:
DB 0E1 ; HELP key value
DB 07F-FUNC ; add-quantity for FUNC
L1:
DB 0C2,0C9,0C0,0C8,0C4 ; DOWN, NEXT, UP, PREV, HOME
DB 097,097 ; shift-F7 key, disabled Alt-F9 key
N_CONTROL_KEYS EQU $-L1
DW HELP_HELP ; pointer to "HELP" message, the name of Wang's HELP key
L2:
DW WANG_COPY ; VID_COPY routine
DW WANG_ATTR ; VID_ATTR routine
DW RET ; there is no VID_FIX necessary on the Wang
DW WANG_BELL ; BIOS_BELL routine
DW WANG_KEY ; BIOS_KEY routine
DW RET
DW RET
DW 0F000 ; new value for VIDEO_SEG
DB 0 ; normal-video attribute for the Wang PC
DB 2 ; reverse-video attribute for the Wang PC
N_BIOS_CALLS EQU ($-L2)/2
; Other Wang keycodes: F1--F16 80--8F
; Prev C8 Erase CB
; Insert C6 Delete C7
; <--- C3 ---> C1
; EXEC C5
; All the above codes add 010 for SHIFT versions.
; NO ALT KEY!!!
; Print E3 Back Tab CD
; Cancel E0 Shift Cancel 03
; WANG_CONFIG is the BIOS initialization routine for a Wang PC. We copy the
; values of WANG_KEYS to various locations, then we fetch the value of
; ENABLE_PORT, that lets us access Wang's video memory, then we move the
; user's cursor to the lower left corner.
L1: ; console codes to move cursor to lower left corner
DB 01B,'[25;1H' ; row 25, column 1
L2 EQU $-L1 ; L2 is the count of bytes
WANG_CONFIG:
MOV SI,WANG_KEYS ; point to Wang's table of key codes and other values
CALL NEW_KEYS ; plug the new values into our program's data structures
MOV AL,1 ; function code for GET BIOS ENVIRONMENT
INT 088 ; sets ES to a segment where we'll find port #
ES MOV BX,[BX+10] ; fetch a pointer
ES MOV AH,[BX+19] ; use the pointer to fetch the high of the port #
MOV AL,010 ; low of the port # is always 010
MOV ENABLE_PORT,AX ; store the port number
MOV DS,CS ; point DS to our program, for console sequence
MOV DX,L1 ; point DX to the "go to lower left" console sequence
MOV CX,L2 ; load the number of bytes in the sequence
MOV BH,0 ; device number, maybe? I don't know for sure
MOV AL,0D ; function number, maybe? I don't know for sure
INT 088 ; output escape string, user's cursor goes to lower left
RET
; WANG_COPY is the Wang-PC version of the VID_COPY routine. The character
; and attribute bytes are reversed from what they are on the IBM-PC, so
; AH and AL are swapped before and after every word output. There are no
; snow problems; so we can get away with copying everything every time.
; We do need to enable the video memory, though.
WANG_COPY:
MOV DX,ENABLE_PORT ; fetch the port number for enabling video memory
MOV AL,1 ; value 1 causes memory to be enabled
OUT DX,AL ; we can now access the video memory
L1: ; loop here for each character to be copied
LODSB ; fetch the next character
XCHG AH,AL ; swap character into AH, attribute byte into AL
STOSW ; output the word to video memory
MOV AH,AL ; copy the attribute byte back to AH, for next char
LOOP L1 ; loop to copy the next character
L2: ; common exit with WANG_ATTR
MOV AL,0 ; value 0 shuts off access to video memory
OUT DX,AL ; video access is now disabled
RET
; WANG_ATTR is the Wang-PC version of the VID_ATTR routine. The attribute
; byte is the low byte of the DI-pointed video memory. Also, to access it,
; we must send the code that enables Wang video memory.
WANG_ATTR:
PUSH AX ; preserve the attribute code
MOV DX,ENABLE_PORT ; fetch the port number for enabling video memory
MOV AL,1 ; value 1 causes memory to be enabled
OUT DX,AL ; we can now access the video memory
POP AX ; restore the attribute code
STOSB ; output the attribute byte to the LOW byte of video word
JMP L2 ; join common code to disable video access
; WANG_KEY is the Wang-PC version of the BIOS_KEY routine.
WANG_KEY:
PUSH BX ; preserve register across call
L1: ; loop here to wait for a key to become ready
MOV AL,15 ; Wang BIOS function code for GET KEY STATUS
MOV BL,2 ; another parameter for Wang BIOS - I'm not sure which
INT 088 ; call Wang BIOS to get the status and maybe the key
TEST AL ; do we have a key?
JNZ L1 ; loop if not, to try again
XCHG AX,BX ; we do: swap the key code into AL for return
POP BX ; restore clobbered register
RET
; WANG_BELL is the Wang-PC version of the BIOS_BELL routine.
WANG_BELL:
MOV BX,7 ; BL=7 is the BELL code; the BIOS also wants BH=0
MOV AL,6 ; Wang BIOS function code for CONSOLE OUTPUT
INT 088 ; output the BELL control code to the Wang console
RET
;------------------
; TI-PC INTERFACE
;------------------
; Thanks to David R. Cook for writing the following code. I have reformatted
; it to look like the rest of my code, and made optimizations.
TIPC_KEYS:
DB 0B5 ; key code for F11 - the help key
DB 0AA-FUNC ; F1 is code 0AB on the TI-PC
L1:
DB 0C0 ; down-arrow key
DB 0C1 ; no PgDn key on the TI-PC, so we use alt-down-arrow code
DB 0B8 ; up-arrow key
DB 0B9 ; no PgUp key on the TI-PC, so we use alt-up-arrow code
DB 0B7 ; HOME key
DB 0CA ; shift-F7 key
DB 0E0 ; alt-F9 key
N_CONTROL_KEYS equ $-L1
DW F11_HELP ; pointer to help message
L2:
DW TIPC_COPY ; VID_COPY routine
DW TIPC_ATTR ; VID_ATTR routine
DW TIPC_FIX ; VID_FIX routine
DW TIPC_BELL ; BIOS_BELL routine
DW TIPC_KEY ; BIOS_KEY routine
DW RET
DW RET
DW 0DE00 ; new value for VIDEO_SEG
DB 0F ; normal-video attribute for the TI-PC
DB 01F ; reverse-video attribute for the TI-PC
N_BIOS_CALLS equ ($-L2)/2
; Other TI keycodes:
; key +shift +alt +ctrl plain
; ----------------------------------
; F1 0C4 0D8 0CE 0AB
; ...
; F10 0CD 0E1 0D7 0B4
; F11 "x" "|" "z" 0B5
; F12 "y" "}" "{" 0B6
;
; PRNT 0E2
; INS 098 09A 099 0C2
; DEL 0A8 0AA 0A9 0C3
; UP AR 0F8 0B9 0F4
; DN AR 0F9 0C1 0E6
; LT AR 0FB 0BC 0E3 0BB
; RT AR 0FA 0BE 0E4 0BD
; HOME 0F6 0F5 0E7
; TAB 07F ignored ignored 09
; TIPC_CONFIG is the BIOS initialization routine for the TI-PC. We copy the
; values in TIPC_KEYS to various locations, then we drop into TIPC_FIX,
; to reset the cursor.
TIPC_CONFIG:
MOV SI,TIPC_KEYS ; point to configuration-table for TI-PC's BIOS
CALL NEW_KEYS ; copy the values to our tables
TIPC_FIX:
MOV AH,014 ; BIOS function code for "clear graphics screen"
INT 049 ; clear the graphics screen
MOV AH,013 ; BIOS function code for "clear text screen"
INT 049 ; clear the text screen
MOV AH,2 ; BIOS function code for "position the cursor"
MOV DX,1 BY 24 ; first column, 24th row
INT 049 ; move the user's cursor to the bottom left corner
RET
; TIPC_COPY is the VID_COPY routine for the TIPC video board. The attribute
; AH is written to a single memory-mapped latch in the video segment.
; Then the text bytes can be copied as-is.
TIPC_COPY:
ES MOV B[01801],AH ; set the attribute latch
SHR DI,1 ; adjust the video address for bytes, not words
REP MOVSB ; copy the text as-is
SHL DI,1 ; restore the video address to words, not bytes
RET
; TIPC_ATTR is the VID_ATTR routine for TI-PC computer. We change the
; attribute latch to the one provided in AL, then we add 0 to the video
; character in memory, causing the new latch value to take effect.
TIPC_ATTR:
SHR DI,1 ; adjust video address for bytes, not words
E